<?php
/*
	[Office 515158] (C) 2009-2012 天生创想 Inc.
	$Id: mod_union.php 1209087 2012-01-08 08:58:28Z baiwei.jiang $
*/
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
empty($do) && $do = 'list';
if ($do == 'list') {
		$user = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."user_union WHERE uid = '".$_USER->id."'");
		if($user['id']==''){
			$user_union = array(
				'usertype' => '0',
				'unionid' => '0',
				'uid' => $_USER->id
			);
			insert_db('user_union',$user_union);
		}
		include_once('template/union.php');
} elseif ($do == 'save') {
		$user_union = array(
			'usertype' => $_POST['usertype'],
			'unionid' => $_POST['unionid']
		);
		update_db('user_union',$user_union, array('uid'=>$_USER->id));
	 show_msg('信息设置成功，从现在开始你所查看到的信息是该企业的信息！', 'admin.php?ac='.$ac.'&fileurl='.$fileurl.'');	

} 
?>